package com.jwaoo.mobile.view.main.repository;

import android.app.Activity;

import com.dx.as.common.CommonUtils;
import com.dx.as.listener.IProInterface;
import com.jwaoo.chat.ChatHelpter;
import com.jwaoo.mobile.ApplicationHelper;
import com.jwaoo.mobile.view.account.AccountBean;
import com.jwaoo.mobile.view.main.model.MainModel;

/**
 * Created by jwaoo on 2017/7/21.
 */

public class MainPresenter extends IProInterface{

    private MainModel mainModel;
    public MainPresenter(Activity activity) {
        super(activity);
        mainModel = new MainModel( activity.getApplicationContext(),this);
    }

    @Override
    public void getDataFromNetOrDB(Object... parms) {
        mainModel.getData();
    }

    @Override
    public void initialataData() {

    }

    @Override
    public void onResponse(Object response, int flg) {
        if (response != null){
            AccountBean bean = (AccountBean) response;
            ChatHelpter.initChat(bean.getId());
            ApplicationHelper.setAccountInfo(bean);

        }
    }

    @Override
    public void onFailure(Throwable t) {

    }
}
